Microcontrollers are found in wide variety of products, such as electronic consumer devices, household appliances and even cars. A product can best be controlled by a microcontroller that is clocked by a stable and accurate oscillating signal. One method of generating a stable and accurate clock signal is to use a phase-locked loop (PLL) that receives an accurate reference signal from an external crystal oscillator. Manufacturing costs can be reduced, however, by generating the clock signal using an internal, on-chip oscillator as opposed to a more expensive external crystal oscillator.
An internal precision oscillator in a microcontroller can be an RC oscillator. A capacitor of the RC circuit is charged and discharged after the voltage across the capacitor reaches a lower and upper trigger voltage, respectively. The rate at which the capacitor is charged and discharged depends on the RC time constant of the RC circuit. The output frequency can be tuned by controlling either the capacitance of the capacitor and/or the resistance of the resistor in the RC circuit.
In some applications, a microcontroller experiences a wide variation in its operating temperature. Temperature variation can affect the frequency of the clock signal output by the RC oscillator, and that clock signal may become insufficiently stable and accurate for the particular application. For example, the RC oscillator may contain a resistor whose resistance changes with temperature, i.e., the resistor has a positive or negative temperature coefficient. A change in resistance may effect not only the RC time constant, but also the trigger voltages at which the capacitor is charged and discharged.
FIG. 1 (prior art) shows a conventional RC oscillator 10 with an RC circuit 11. Oscillator 10 has an RS latch 12 for switching between the output of two comparators. An RC node 13 is coupled to a inverting input lead 14 of a discharge comparator 15 and to a non-inverting input lead 16 of a charge comparator 17. Charge comparator 17 detects when the voltage on RC node 13 reaches a lower reference voltage, at which time RS latch 12 causes charge to accumulate on RC node 13. Discharge comparator 15 detects when the voltage on RC node 13 reaches a higher reference voltage, at which time RS latch 12 causes charge to discharge from RC node 13. The reference voltages are generated by a voltage divider 18 formed by a resistor string. As the operating temperature of oscillator 10 changes, the resistances of the resistors in the resistor string change, thereby changing the reference voltages.
FIG. 2 (prior art) is a waveform diagram illustrating the change in frequency of the clock signal output by oscillator 10 as a result of a change in the reference voltages caused by a temperature variation. Oscillator 10 outputs a clock signal 19 at a lower temperature and a slower clock signal 20 at a higher temperature. In this example, as the temperature increases, the resistance of each resistor in voltage divider 18 increases. The increased resistance causes a lower reference voltage 21 to increase and an upper reference voltage 22 to increase by an even greater absolute amount. Lower reference voltage 21 increases from 1 V to 1.2 V. Upper reference voltage 22 increases from 3 V to 3.6 V. Thus, a range 23 between reference voltages is 2 V at a lower temperature. At a higher temperature, oscillator 10 exhibits a range 24 of 2.4 V between reference voltages. Where the RC time constant does not change with temperature, the period 25 required to charge and discharge RC node 13 over range 24 of 2.4 V is longer than the period 26 required to charge and discharge RC node 13 over range 23 of 2 V. The frequency of the clock signal output by oscillator 10, therefore, decreases as temperature increases. Moreover, where the resistance of the resistor in RC circuit 11 increases with increasing temperature, the RC time constant also increases, which slows the frequency of the clock signal even more.
One method of compensating for resistance changes caused by temperature variation in RC oscillators relies on matching resistors with positive temperature coefficients to resistors having negative temperature coefficients. U.S. Pat. No. 5,889,441, which is herein incorporated by reference, describes an RC oscillator whose output frequency is substantially independent of temperature variation because the RC oscillator uses matched resistor pairs whose combined resistance is substantially temperature independent. It can be difficult, however, to manufacture an on-chip resistor whose temperature coefficient inversely matches that of its paired resistor over the entire operating temperature range of a microcontroller.
Another method for compensating for temperature variations uses a separate regulator circuit that generates precise reference voltages. The regulator circuit generates temperature independent reference voltages that are used by the comparators as trigger voltages. Especially where the RC oscillator is on the microcontroller chip, however, the regulator circuit occupies valuable space.
A method is sought for generating a clock signal from an RC oscillator that is substantially temperature independent and that does not require matched resistor pairs or a reference voltage regulator circuit.